<!--
 * @Descripttion: 
 * @version: 
 * @Author: 尹伊
 * @Date: 2020-08-19 15:29:06
 * @LastEditors: 尹伊
 * @LastEditTime: 2020-09-11 17:49:56
-->
<template>
  <div>
    <div class="content">
      <!-- <div class="item" v-for='index in 6'></div> -->
      <el-input style="width: 300px;" v-model.trim="form.pastAdjustFee" @blur="inputMoney($event,'pastAdjustFee')">
      </el-input>
    </div>
  </div>
</template>
<script>
  import factory from '@/factory/util.js'
  export default {
    data() {
      return {
        total: 8,
        form: {
          pastAdjustFee: ''
        }
      }
    },
    created() {
      console.log(this.keepTwoDecimalFull(1234.136))
    },
    methods: {
      inputMoney(el, name) {
        this.form[name] = factory.getInputValue(el);
        factory.moneyNValid(this.form[name], this.result)
        let data = factory.delcommafy(this.form[name])
        console.log(data)
      },
      result() {
        console.log('结果')
      },
      keepTwoDecimalFull(num) {
        var result = parseFloat(num);
        if (isNaN(result)) {
          console.error('参数非数值，无法四舍五入保留两位小数！');
          return false;
        }
        result = Math.round(num * 100) / 100;
        var s_x = result.toString();
        var pos_decimal = s_x.indexOf('.');
        if (pos_decimal < 0) {
          pos_decimal = s_x.length;
          s_x += '.';
        }
        while (s_x.length <= pos_decimal + 2) {
          s_x += '0';
        }
        return s_x;
      }
    },
  }
</script>
<style>
  .content {}

  .item {
    border: 1px solid #000;
    width: 225px;
    height: 325px;
  }
</style>